<template>
  <div class="InformationDetails">
     <goBack title="  "></goBack>
    <div class="title">{{ info.titile }}</div>
    <div class="box">
      <div class="box-left">
        <img src="../../assets/images/InformationDetails-1.png" />
        <div class="box-left-name">高帮帮老师</div>
        <div class="box-left-time">{{ info.updatetime }}</div>
      </div>
      <div class="box-right">
        <div class="box-right-text" @click="attention">+ 关注</div>
      </div>
    </div>
    <p v-html="info.content"></p>
    <div class="box box1">
      <div class="box-left">
        <img src="../../assets/images/InformationDetails-1.png" />
        <div class="box-left-name">高帮帮老师</div>
        <div class="box-left-time">{{ info.updatetime }}</div>
      </div>
      <div class="box-right">
        <div class="box-right-text" @click="attention">+ 关注</div>
      </div>
    </div>

    <div class="gong-wrap" v-show="centerDialogVisible">
      <div class="gong-bg">
        <span class="gong-text1">【微信公众号】</span>
        <img class="gong-img" :src="platform" />
        <span class="gong-text2">保存二维码到本地</span>
        <span class="gong-text2 gong-text3">微信扫一扫添加</span>
        <div class="button-cover">截图保存</div>
        <div class="close" @click="close">
          <img src="../../assets/images/gong-close.png" />
        </div>
      </div>

    </div>
  </div>
</template>

<script setup>
import { useRoute } from 'vue-router';
import goBack from '../../components/goBack.vue';
import { onMounted, ref } from 'vue';
import { getArticle, getQrcode } from '../../api/apiList/homePage.js';
const route = useRoute();
const tabIndex = route.query.id;
const centerDialogVisible = ref(false)
let info = ref({});
let platform = ref({});
onMounted(async () => {
  // 获取列表数据
  await getArticle(tabIndex).then((res) => {
    const { result } = res;
    info.value = result;
  });
});
const attention = () => {
  centerDialogVisible.value = true
  getQrcode().then((res) => {
    const { result } = res;
    platform.value = result.platform;
  });
}
const close = () => {
  centerDialogVisible.value = false
}

</script>

<style lang="less" scoped>
img {
  width: 100%;
}

.InformationDetails {
  padding: 0 14px;

  .title {
    font-size: 24px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #333333;
    line-height: 32px;
    margin-bottom: 20px;
    margin-top: 88px;
  }

  .box1 {
    height: 75px;
    background: #f7f9ff;
    padding: 0 26px;
    margin-bottom: 30px;
  }

  .box {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .box-left {
      position: relative;
      display: flex;
      flex-direction: column;

      img {
        position: absolute;
        left: 0;
        top: 0;
        width: 37px;
        height: 37px;
      }

      .box-left-name {
        margin-left: 44px;
        margin-bottom: 2px;
        font-size: 16px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #333333;
        line-height: 22px;
      }

      .box-left-time {
        margin-left: 44px;
        font-size: 12px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #999999;
        line-height: 17px;
      }
    }

    .box-right {
      width: 82px;
      height: 22px;
      background: #7a9afc;
      box-shadow: 0px 1px 2px 0px rgba(161, 146, 213, 0.58);
      border-radius: 11px;
      text-align: center;

      .box-right-text {
        font-size: 12px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #ffffff;
        line-height: 22px;
        letter-spacing: 1px;
      }
    }
  }

  .gong-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vh;
    height: 100vh;
    background: rgba(0, 0, 0, 0.78);

    .gong-bg {
      position: fixed;
      top: 50%;
      left: 50%;
      width: 315px;
      margin-left: -157.5px;
      height: 390px;
      margin-top: -200px;
      background-image: url('../../assets/images/gong-bg.png');
      background-size: 100%;
      background-repeat: no-repeat;
      z-index: 999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;

      .gong-text1 {
        font-size: 18px;
        font-family: PingFangSC-Semibold, PingFang SC;
        font-weight: 600;
        color: #000000;
        line-height: 25px;
        margin-bottom: 10px;
        margin-top: 45px;
      }

      .gong-img {
        width: 190px;
        height: 190px;
        margin-bottom: 13px;
      }

      .gong-text2 {
        font-size: 18px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #333333;
        line-height: 25px;
        margin-bottom: 5px;
      }

      .gong-text3 {
        margin-bottom: 17px;
      }

      .button-cover {
        width: 165px;
        height: 52px;
        background: linear-gradient(180deg, #D4CEFF 0%, #797BEA 100%);
        border-radius: 32px;
        position: absolute;
        bottom: -30px;
        left: 50%;
        margin-left: -82.5px;
        font-size: 22px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #FFFFFF;
        line-height: 30px;
        text-align: center;
        line-height: 52px;
      }

      .close {
        position: absolute;
        bottom: -84px;
        width: 38px;
        height: 38px;
      }
    }
  }

  p {
    font-size: 16px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #444444;
    line-height: 22px;
    letter-spacing: 2px;
  }

  img {
    width: 100%;
  }
}
</style>
